package org.ycx.doc.dao.auto;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.ycx.doc.dao.model.DocModuleDefine;
import org.ycx.doc.dao.model.DocModuleDefineExample;

public interface DocModuleDefineMapper {
    @SelectProvider(type=DocModuleDefineSqlProvider.class, method="countByExample")
    long countByExample(DocModuleDefineExample example);

    @DeleteProvider(type=DocModuleDefineSqlProvider.class, method="deleteByExample")
    int deleteByExample(DocModuleDefineExample example);

    @Delete({
        "delete from doc_module_define",
        "where MODULE_ID = #{moduleId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer moduleId);

    @Insert({
        "insert into doc_module_define (ACTION_DESC, ACTION_TYPE, ",
        "REQ_URL, REQ_TYPE, ",
        "REQ_MSG, RES_TYPE, ",
        "RES_MSG)",
        "values (#{actionDesc,jdbcType=VARCHAR}, #{actionType,jdbcType=INTEGER}, ",
        "#{reqUrl,jdbcType=VARCHAR}, #{reqType,jdbcType=INTEGER}, ",
        "#{reqMsg,jdbcType=VARCHAR}, #{resType,jdbcType=INTEGER}, ",
        "#{resMsg,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="moduleId", before=false, resultType=Integer.class)
    int insert(DocModuleDefine record);

    @InsertProvider(type=DocModuleDefineSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="moduleId", before=false, resultType=Integer.class)
    int insertSelective(DocModuleDefine record);

    @SelectProvider(type=DocModuleDefineSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="MODULE_ID", property="moduleId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ACTION_DESC", property="actionDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="ACTION_TYPE", property="actionType", jdbcType=JdbcType.INTEGER),
        @Result(column="REQ_URL", property="reqUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQ_TYPE", property="reqType", jdbcType=JdbcType.INTEGER),
        @Result(column="REQ_MSG", property="reqMsg", jdbcType=JdbcType.VARCHAR),
        @Result(column="RES_TYPE", property="resType", jdbcType=JdbcType.INTEGER),
        @Result(column="RES_MSG", property="resMsg", jdbcType=JdbcType.VARCHAR)
    })
    List<DocModuleDefine> selectByExample(DocModuleDefineExample example);

    @Select({
        "select",
        "MODULE_ID, ACTION_DESC, ACTION_TYPE, REQ_URL, REQ_TYPE, REQ_MSG, RES_TYPE, RES_MSG",
        "from doc_module_define",
        "where MODULE_ID = #{moduleId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="MODULE_ID", property="moduleId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ACTION_DESC", property="actionDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="ACTION_TYPE", property="actionType", jdbcType=JdbcType.INTEGER),
        @Result(column="REQ_URL", property="reqUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQ_TYPE", property="reqType", jdbcType=JdbcType.INTEGER),
        @Result(column="REQ_MSG", property="reqMsg", jdbcType=JdbcType.VARCHAR),
        @Result(column="RES_TYPE", property="resType", jdbcType=JdbcType.INTEGER),
        @Result(column="RES_MSG", property="resMsg", jdbcType=JdbcType.VARCHAR)
    })
    DocModuleDefine selectByPrimaryKey(Integer moduleId);

    @UpdateProvider(type=DocModuleDefineSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") DocModuleDefine record, @Param("example") DocModuleDefineExample example);

    @UpdateProvider(type=DocModuleDefineSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") DocModuleDefine record, @Param("example") DocModuleDefineExample example);

    @UpdateProvider(type=DocModuleDefineSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(DocModuleDefine record);

    @Update({
        "update doc_module_define",
        "set ACTION_DESC = #{actionDesc,jdbcType=VARCHAR},",
          "ACTION_TYPE = #{actionType,jdbcType=INTEGER},",
          "REQ_URL = #{reqUrl,jdbcType=VARCHAR},",
          "REQ_TYPE = #{reqType,jdbcType=INTEGER},",
          "REQ_MSG = #{reqMsg,jdbcType=VARCHAR},",
          "RES_TYPE = #{resType,jdbcType=INTEGER},",
          "RES_MSG = #{resMsg,jdbcType=VARCHAR}",
        "where MODULE_ID = #{moduleId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(DocModuleDefine record);
}